// pages/Order/logistics/logistics.js
var url = wx.getStorageSync('url')
var shopid = wx.getStorageSync('shopid')
var userId = wx.getStorageSync('userId')
var openid = wx.getStorageSync('openid')
var time_ss = wx.getStorageSync('time_ss')

Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var url = wx.getStorageSync('url')
    var shopid = wx.getStorageSync('shopid')
    var userId = wx.getStorageSync('userId')
    var openid = wx.getStorageSync('openid')
    var time_ss = wx.getStorageSync('time_ss')
    console.log(options)
    var that = this
    wx.showLoading({
      title: '加载中',
    })
    // 获取订单信息
    wx.request({
      url: url+'gateOrder/searchOrderById',
      data: {
        "list": false,
        "nodeId": "kdslfw",
        "platform": 2,
        "privId": "default",
        "resId": "default",
        "sendTime": time_ss,
        "seq": 1,
        "shopId": shopid,
        "source": 11,
        "sysVer": "1.0.0",
        "token": "kdsjfoewi12ijsldks",
        "type": 1,
        "userId": userId,
        "userType": 1,
        "content": {
          "id": '0401d9b8dd5476cf4ddd8c80e32ebfe43a85'//options.id
        }
      },
      method: "POST",
      header: { "Content-Type": "application/JSON" },
      success: function (e) {
        console.log(e)
        var data = e.data.content.wareInfos[0]
        var address = e.data.content.address.detail
        var logistics = e.data.content.logistics
        that.setData({
          datas: data,
          addressa : address
        })

        // 获取物流
        wx.request({
          url: url + 'gateOrder/queryLogistics',
          data: {
            "list": false,
            "nodeId": "kdslfw",
            "platform": 2,
            "privId": "default",
            "resId": "default",
            "sendTime": time_ss,
            "seq": 1,
            "shopId": shopid,
            "source": 11,
            "sysVer": "1.0.0",
            "token": "kdsjfoewi12ijsldks",
            "type": 1,
            "userId": userId,
            "userType": 1,
            "content": {
              // "logistics": "3711371253068"
              "logistics": logistics
            }
          },
          method: "POST",
          header: { "Content-Type": "application/JSON" },
          success: function (e) {
            wx.hideLoading();
            var data = e.data.content.result
            console.log(data)
            that.setData({
              logistics: data
            })
          }
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})